<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<style>
    body{
        font-family: cursive,serif;
    }
</style>
<body>


<script>
    var num = prompt("输入金字塔的行数");
    for ( i = 1; i <= num; i++){
        for (j = 0; j < num -i; j++){
            document.write("&nbsp");
        }
        for ( p = 0; p < 2*i-1; p++){
            document.write("*");
        }
        document.write("<br>");
    }



</script>

</body>
</html>